const { wxMiniLogin } = require("./wx_mini/index.js");
const { qwMiniLogin } = require("./qw_mini/index.js");
const { dingdingWebLogin } = require("./dingding_web/index.js");
const { qwWebLogin } = require("./qw_web/index.js");
const { BaseErr } = require("utils");
const {
    Type_Wx_Mini,
    Type_Wx_Web,
    Type_Qw_Mini,
    Type_Qw_Web,
    Type_DingDing_Web,
} = require("../constEnum.js");
async function getAuthData(type, appId, appSecret, code) {
    if (type === Type_Wx_Mini) {
        return await wxMiniLogin(appId, appSecret, code);
    }
    if (type === Type_Wx_Web) {
        return;
    }
    if (type === Type_Qw_Mini) {
        return await qwMiniLogin(appId, appSecret, code);
    }
    if (type === Type_Qw_Web) {
        return await qwWebLogin(appId, appSecret, code);
    }
    if (type === Type_DingDing_Web) {
        return await dingdingWebLogin(appId, appSecret, code);
    }
    // 位置类型
    let err = new BaseErr(-5000, `仅支持${allTypes.join("、")}这些类型`);
    return [err, false];
}

module.exports = getAuthData;
